﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xiezl.Common.Data
{
    /// <summary>
    /// 产品信息
    /// </summary>
    public class Product : IEntity<Guid>, IJsonEntity<Product>
    {

        public Guid Id { get; set; }

        public string Code { get; set; }

        public string Name { get; set; }
        /// <summary>
        /// 规格
        /// </summary>
        public string Specification { get; set; }


        /// <summary>
        /// 产品大类Id
        /// </summary>
        public Guid CategoryId { get; set; }

        /// <summary>
        /// 产品大类信息
        /// </summary>
        public virtual ProductCategory ProductCategory { get; set; }

        public Product GetJsonEntity()
        {
            return new Product()
            {
                CategoryId = this.CategoryId,
                Code = this.Code,
                Id = this.Id,
                Name = this.Name,
                ProductCategory = new ProductCategory()
                {
                    Code = this.ProductCategory.Code,
                    Id = this.ProductCategory.Id,
                    Name = this.ProductCategory.Name
                },
                Specification = this.Specification
            };
        }
    }
}
